home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Club 1999 October
/
Software of the Month - Ultimate Collection Shareware 266.iso
/
pc
/
Xtras
/
Animation Wizard.dir
/
00005_Script_IncrDecrCast
< prev
next >
Wrap
Text File
|
1997-05-10
|
2KB
|
93 lines
-- IncrDecrCast script
property iCastNumOffset
property inPicts
property ichPict
property ichButton
property iCurrentValue
property iCastNumNormal
property iCastNumIncr
property iCastNumDecr
on birth me
return me
end birth
on mInit me, castNumOffset, defaultVal, nPicts, chPict
set iCastNumOffset = castNumOffset
set inPicts = nPicts
set ichPict = chPict
set ichButton = ichPict + 1
mSetValue(me, defaultVal)
puppetsprite ichPict, TRUE
end mInit
on mHit me
set castNumNormal = the castnum of sprite ichButton
set iCastNumNormal = castNumNormal
set iCastNumIncr = castNumNormal + 1
set iCastNumDecr = castNumNormal + 2
set mouseDownFlag = TRUE
set firstTimeFlag = TRUE
repeat while mouseDownFlag
if rollOver(ichButton) then
if the mouseV <= the locV of sprite ichButton then -- upper half, increase
set the castNum of sprite ichButton = iCastNumIncr
set iCurrentValue = IncrMod(iCurrentValue, inPicts)
else -- lower half, decrement
set the castNum of sprite ichButton = iCastNumDecr
set iCurrentValue = DecrMod(iCurrentValue, inPicts)
end if
mDraw(me)
else -- not currently rolled over the button
set the castNum of sprite ichButton = castNumNormal
updateStage
end if
if firstTimeFlag then -- this allows for easy one step increments
set firstTimeFlag = FALSE
wait(15)
end if
set mouseDownFlag = the mouseDown
end repeat
set the castNum of sprite ichButton = castNumNormal
updateStage
return iCurrentValue
end mHit
on mGetValue me
return iCurrentValue
end mGetValue
on mGetCastNum me, index
return (iCastNumOffset + index)
end mGetCastNum
on mSetValue me, theNewValue
if (theNewValue < 1) or (theNewValue > inPicts) then
alert("Bad value passed to IncrDecrCast:" && theNewValue & RETURN¼
& "Needs to be between 1 and " & inPicts)
return
end if
set iCurrentValue = theNewValue
mDraw(me)
updateStage
end mSetValue
on mDraw me
set the castNum of sprite ichPict = iCastNumOffset + iCurrentValue
updateStage
end mDraw
on mCleanup me
puppetsprite ichPict, FALSE
end mCleanup